#!/bin/bash

# 消融实验：关闭TwoStageAttention
# 实验ID: Attn-01

# 切换到项目根目录
cd "$(dirname "$0")/.."

# 临时修改run_main_channel.py中的参数默认值
python -c "
import fileinput
import sys

# 修改use_two_stage_attention参数为False
for line in fileinput.input('xindaoyuce/run_main_channel.py', inplace=True):
    if \"parser.add_argument('--use_two_stage_attention'\" in line:
        print(\"parser.add_argument('--use_two_stage_attention', action='store_true', help='是否使用TwoStageAttention', default=False)\")
    else:
        print(line, end='')
"

# 运行实验，关闭TwoStageAttention
python run_main_channel.py \
  --model_comment "ablation_no_twostage" \
  --train_epochs 100 \
  --batch_size 4 \
  --learning_rate 0.0005 \
  --islora \
  --lora_r 8 \
  --load_spatial_corr \
  --optim adam
  
# 恢复run_main_channel.py中的参数默认值
python -c "
import fileinput
import sys

# 恢复use_two_stage_attention参数为True
for line in fileinput.input('xindaoyuce/run_main_channel.py', inplace=True):
    if \"parser.add_argument('--use_two_stage_attention'\" in line:
        print(\"parser.add_argument('--use_two_stage_attention', action='store_true', help='是否使用TwoStageAttention', default=True)\")
    else:
        print(line, end='')
"

echo "Attn-01实验完成: 关闭TwoStageAttention" 